package com.nanmeishu.serviceserver.service;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;


public class TestMain {
    public static void main(String[] args) {
        TestServiceService serviceService=new TestServiceService();
        TestService service = serviceService.getTestServicePort();
        // 1、创建document对象
        Document document = DocumentHelper.createDocument();
        // 2、创建根节点rss
        Element rss = document.addElement("db");
        // 3、向rss节点添加version属性
        rss.addAttribute("version", "2.0");
        // 4、生成子节点及子节点内容
        Element driver = rss.addElement("driver");
        driver.setText("com.mysql.jdbc.Driver");
        // 5、设置生成xml的格式
        OutputFormat format = OutputFormat.createPrettyPrint();
        // 设置编码格式
        format.setEncoding("UTF-8");
        String xml = document.asXML();
        System.out.println(xml);
//        String xml =new String(
//                "<ESBEntry>" +
//                "<AccessControl>" +
//                "<SysFlag>1</SysFlag>" +
//                "<UserName>WZHBAGL</UserName>" +
//                "<Password>WZHBAGL_1127</Password>" +
//                "<Fid>BS08005</Fid>" +
//                "<OrderNo>BS08005S51001</OrderNo>" +
//                "<SUBOR_HOSPITAL_DISTRICT>GZ</SUBOR_HOSPITAL_DISTRICT>" +
//                "</AccessControl>" +
//                "<Fid>BS08005</Fid>" +
//                "<OrderNo>BS08005S51001</OrderNo>" +
//                "</ESBEntry>");
//        Document document = null;
//        try {
//            document = DocumentHelper.parseText(xml);
//        } catch (DocumentException e) {
//            e.printStackTrace();
//        }
//        System.out.println(document.asXML());
        String res = service.byXmlTest(xml);
        System.out.println(res);
    }
}
